#include<bits/stdc++.h>
using namespace std;
const int P=998244353;
int main()
{
    freopen("clown.in","r",stdin);
    freopen("clown.out","w",stdout);
    int m,n=1;
    scanf("%d",&m);
    for(int i=1;i<=m;i++)
    {
        int x;
        scanf("%d",&x);
        n*=x;
    }
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%lld",(1ll*a*a%P*a%P*b%P*b%P*b%P-1ll*a*b%P-3ll*a%P*(a-1)%P*b%P-3ll*a%P*b%P*(b-1)%P-3ll*a%P*(a-1)%P*b%P*(b-1)%P+4ll*P)%P);
    return 0;
}